﻿
@model deviceManage.Models.Role;

@{
    Layout = null;
}
<style>
    .menus {
        margin-left: 110px;
        min-height: 36px;
        height: 250px;
        overflow: auto;
        width: 287px;
        border: 1px solid #ddd;
    }

    .center {
        text-align: center;
        padding-top: 10px;
    }
</style>


<div class="layui-form" lay-filter="createForm" style="padding: 20px 30px 0 0;">
    <input type="hidden" name="id" id="id" value="@Model.Id" />
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-inline">
            <input type="text" name="name" id="name" value="@Model.RoleName" maxlength="50" lay-verify="required" placeholder="角色名称" autocomplete="off" class="layui-input layui-form-danger">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">只读</label>
        <div class="layui-input-inline">
            @if (Model.view_flag != null)
            {
                <input name="view_flag" value="1" type="checkbox" lay-skin="primary" checked/>
            }
            else
            {
                <input name="view_flag" value="1" type="checkbox" lay-skin="primary" />
            }

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权限菜单</label>
        <div class="layui-input-block menus">
            <ul id="demoTree" class="dtree" data-id="0"></ul>
        </div>
    </div>

    <div class="layui-form-item center">
        <input type="button" lay-submit="" lay-filter="create" value="确认" class="layui-btn">
    </div>
</div>

<script>
    form.render("checkbox");
    var dtree = layui.dtree;
    var DemoTree = dtree.render({
        elem: "#demoTree",
        url: "/role/GetRoleMenuTree?id=@Model.Id",
        method: "get",
        dot: false,
        icon: "-1",  // 隐藏二级图标
        checkbar: true,
        skin: "layui"  // layui主题风格
    });

</script>